﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using Microsoft.Win32;

namespace NLayers.Setup.CustomAction
{
    class Program
    {
        static void Main(string[] args)
        {
            ActionUtils actionUtils = new ActionUtils();

            actionUtils.CreateFolders();

            CopyFiles(actionUtils.ProjectTemplatesPath, actionUtils.ItemTemplatesPath);

            actionUtils.ExecuteInstallVSTemplatesCommand();
        }

        /// <summary>
        /// Copies the project and item template zip files
        /// </summary>
        /// <param name="actionUtils"></param>
        private static void CopyFiles(string projectTemplatesPath, string itemTemplatesPath)
        {
            File.WriteAllBytes(projectTemplatesPath + "NLayers.zip", NLayersFiles.NLayers);
            File.WriteAllBytes(itemTemplatesPath + "BLClass.zip", NLayersFiles.BLClass);
            File.WriteAllBytes(itemTemplatesPath + "DAInterface.zip", NLayersFiles.DAInterface);
            File.WriteAllBytes(itemTemplatesPath + "DAImplementation.zip", NLayersFiles.DAImplementation);
            File.WriteAllBytes(itemTemplatesPath + "Info.VSTDIR", NLayersFiles.Info);
        }
    }
}
